package com.anotacion;

import java.awt.im.spi.InputMethod;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class AnocationMain {
    public static void main(String[] args) throws Exception {
        System.out.println("获取IMessage 接口上的注解信息");
        Class<?> clazz = IMessage.class;
        for (Annotation annotation:clazz.getAnnotations()) {
            System.out.println(annotation);
        }


        System.out.println("********获取MessageImpl子类上的信息**********");
        Class<?> clazzIMPL = MessageImpl.class;
        for (Annotation an:clazzIMPL.getAnnotations()) {
            System.out.println(an);
        }

        System.out.println("********获取MessageImpl子类上的echo方法上的注解信息**********");
        Class<?> clazzIMPL1 = MessageImpl.class;
        Method method =  clazzIMPL1.getDeclaredMethod("echo", String.class);
        for (Annotation an:method.getAnnotations()) {
            System.out.println(an);
        }


    }
}
